package Threading;

public class demo7 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            for (int i = 0; i < 10; i++) {
                System.out.println("hello thread");
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.getStackTrace();
                }
            }
        });
        t.start();
        t.join(3000);

        for (int i = 0; i < 10; i++) {
            System.out.println("hello main");
            Thread.sleep(500);
        }

    }
}
